package cn.com.ghy.android.widget.set;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import cn.com.ghy.android.bean.LoginInfoBean;
import cn.com.ghy.android.widget.ComStaticApp;
import cn.com.ghy.android.widget.R;

/**
 * @软件著作权:金红叶纸业集团有限公司
 * @系统名称:SFA系统
 * @Description:个人信息
 * @author wuz  @date 2011-6-2 09:40:16
 * @版本历史:v1.0
 * @Copyright:Copyright (c) 2011-2012 
 */

public class PersonInfo extends Activity {

	private TextView labTxtUserid = null;
	private TextView labTxtUserName = null;
	private TextView labTxtSaof = null;
	private Button btnChangePwd = null;
	private Intent intent = null;

	private LoginInfoBean loginInfo = null;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		this.setContentView(R.layout.person_info);
		getSession();
		findView();
		init();
		addListener();
	}

	private void getSession() {
		loginInfo = ((ComStaticApp) this.getApplication()).getLoginInfo();
	}

	private void findView() {
		labTxtUserid = (TextView) this.findViewById(R.id.labTxtUserid);
		labTxtUserName = (TextView) this.findViewById(R.id.labTxtUserName);
		labTxtSaof = (TextView) this.findViewById(R.id.labTxtSaof);
		btnChangePwd = (Button) this.findViewById(R.id.btnChangePwd);
	}

	private void init() {
		labTxtUserid.setText(loginInfo.getPernr());
		labTxtUserName.setText(loginInfo.getDspname());
		labTxtSaof.setText(loginInfo.getSaof() + "\n" + loginInfo.getSaofname());
	}

	private void addListener() {
		btnChangePwd.setOnClickListener(btnListener);
	}

	private View.OnClickListener btnListener = new View.OnClickListener() {
		@Override
		public void onClick(View v) {
			switch (v.getId()) {
				case R.id.btnChangePwd :
					intent = new Intent(PersonInfo.this, ModifyPasswd.class);
					PersonInfo.this.startActivity(intent);
					break;
			}

		}
	};
}
